require 'erb'
require File.dirname(__FILE__) + '/profile'

if ARGV.empty? then
	puts 'usage: kcov exe [module1] [module2] ... [moduleN]' 
	exit 0
end

f_index = ExerbRuntime.open('index.rhtml')
f_file  = ExerbRuntime.open('file.rhtml')

begin
	QCov::Profile.run_html_report(	ARGV, 
		[/VC98\\Include/i, /Coding\\include\\boost/i, /Coding\\include\\stl/i, /stdafx/i], 
		ERB.new(f_index.read, nil, '-'), ERB.new(f_file.read, nil, '-') )
	
rescue QCov::Profile::FatalError => e
	STDERR.puts "kcov: #{e}"
	exit 1
ensure
	f_index.close if f_index
	f_file.close if f_file
end

